<?

if ($DATA['component']['id']) {
	
	$_record = array('id_data' => D_MB_SETTINGS, 'id_parent' => $DATA['component']['id'], 'assoc' => '');

	$_fields = array(
		'path' => 'gallery', 
		'w' => 800, 'h' => 600, 
		'tnw' => 128, 'tnh' => 96, 'imode' => MI_FIT, 'tnmode' => MI_FIT,
		'gw' => 128, 'gh' => 96, 
		'gtpb' => 0,
		'param' => 'id', 
		'show_tn' => 1, 'nav' => 0, 'navigator' => 1, 'circular' => 0, 'autoscroll' => 0, 'fancybox' => 0,
		'show_title' => 0, 'show_descr' => 0,
		'caption' => array('large' => true, 'lang' => true),
	);


	switch (action(array('editor_save'))) {
	
		case 'editor_save':

			dataset('killmeta', "(id_data=".D_MB_SETTINGS.") AND (id_parent={$DATA[component][id]})");
			dataset('savemeta', prepareModel($_fields, $_record));
			
			return true;	// end of component edition
	}
	

	$DATA['settings'] = array_merge($_fields, datafetch_array('loadmeta', D_MB_SETTINGS, 
		array('parent' => $DATA['component']['id'], 'getclob' => true)));
	
	foreach($DATA['langs'] as $lang)
		$DATA['settings']['data'][$lang['text']] = datafetch_array('loadmeta', D_MB_SETTINGS, 
			array('parent' => $DATA['component']['id'], 'assoc' => $lang['text'], 'getclob' => true));
		
	return false;

} else exit;
